Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display a friendly message if no files are specified (or when no files match the given pattern) #208

Closed
wants to merge 2 commits into from
Closed

Display a friendly message if no files are specified (or when no files match the given pattern) #208

wants to merge 2 commits into from

Conversation

akshat1
Copy link

@akshat1 akshat1 commented Mar 18, 2017

Currently if files are not specified, Plato exits with a stack trace. This PR intends to print a message saying "No files found" along with the Plato usage help.

Changes (using cli.js as reference):

  • imported info.js into plato.js
  • print console.log and call info.help() if files or files.length are falsy

For issue #205

Before

$ bin/plato -d foo
/git/plato/lib/util.js:15
  var lastSlash = files[0].lastIndexOf(path.sep);
                          ^

TypeError: Cannot read property 'lastIndexOf' of undefined
    at Object.exports.findCommonBase (/git/plato/lib/util.js:15:27)
    at Object.exports.inspect (/git/plato/lib/plato.js:87:29)
    at Object.exports.exec (/git/plato/lib/cli.js:53:9)
    at Object.<anonymous> (/git/plato/bin/plato:19:5)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)

Same result with $bin/plato -d foo bar

After

$ bin/plato -d foo
No files found

Usage : plato [options] file1.js file2.js ... fileN.js
  -h, --help
      Display this help text.
  -q, --quiet
      Reduce output to errors only
  -v, --version
      Print the version.
  -x, --exclude : String
      File exclusion regex
  -d, --dir : String *required*
      The output directory
  -r, --recurse
      Recursively search directories
  -l, --jshint : String
      Specify a jshintrc file for JSHint linting
  -e, --eslint : String
      Specify a eslintrc file for ESLint linting
  -t, --title : String
      Title of the report
  -D, --date : String
      Time to use as the report date (seconds, > 9999999999 assumed to be ms)
  -n, --noempty
      Skips empty lines from line count

akshat1 added 2 commits March 18, 2017 06:35
…s match the given pattern).

Changes (using cli.js as reference):
- imported info.js into plato.js
- print console.log and call info.help() if `files` or `files.length` are falsy

For issue #205
@akshat1 akshat1 closed this Feb 6, 2018
@akshat1 akshat1 deleted the feature--205--friendly-message-when-missing-files branch February 6, 2018 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant